package com.imooc.log.`type`

import org.apache.spark.sql.SparkSession


/**
 * 自定义sparksql外部数据源测试类
 */
object TestApp {
  def main(args: Array[String]): Unit = {
    val sparkSession = SparkSession.builder().appName("TestApp").master("local[2]").getOrCreate()

    val path = this.getClass.getClassLoader.getResource("test-access.log")
    System.out.println(path)

    val data = sparkSession.read.format("com.imooc.log")
      .load(path.toString)

    data.printSchema()

    data.show(false)

    sparkSession.stop()
  }

}
